<!doctype html>
<html lang="zh-ch">
  <head>
    <meta charset="utf-8" />
    <meta content="IE=8" http-equiv="X-UA-Compatible"/>
    <title>绑定多个事件对象</title>
    <script type="text/javascript">
      window.onload = function(){
        var p = document.getElementById("aa")
        var addEvent = function(el,type,fn) {
          var type = "on"+type
          var old = el[type];
          if (typeof el[type] != 'function') {
            el[type] = fn
          }else {
            el[type] = function() {
              old();
              fn();
            }
          }
        }
        addEvent(p,"click",function(){alert('第二次')});
        addEvent(p,"click",function(){alert('第三次')});
      }
    </script>

  </head>
  <body>

    <p id="aa" onclick="alert('第一次')">能绑定多个同类型函数(请点我)</p>
  </body>
</html>
